<template>
    <div class="brother2">
        <button @click="sendMsg">点击发布(发送)消息</button>
    </div>
</template>

<script>
import pubsub from 'pubsub-js';

export default {
    name: 'Brother2',
    methods: {
        sendMsg() {
            // 订阅名是msgName，发布数据
            pubsub.publish('msgName', 'hello ,我现在用msgName为消息名，来给你发送消息了~');
        }
    }
}
</script>

<style>

</style>